<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<script type="text/javascript" src="<?=$this->baseUrl?>/scripts/jquery.js"></script>
<script type="text/javascript">
    var XMLHttpFactories = [
        function () {return new XMLHttpRequest()},
        function () {return new ActiveXObject("Msxml2.XMLHTTP")},
        function () {return new ActiveXObject("Msxml3.XMLHTTP")},
        function () {return new ActiveXObject("Microsoft.XMLHTTP")}
    ];

    function getXMLHttp() {
        var xmlhttp = false;
	for ( var i=0,l=XMLHttpFactories.length; i<l ; i++ ) {
	    try {
	        xmlhttp = new XMLHttpFactories[i]();
	    } catch (e) {
                continue;
	    }
	    break;
	}
	return xmlhttp;
    }
    
    function sendRequest(sendType,url,callback,data) {
        var xmlhttp = getXMLHttp();
	if ( xmlhttp ) {
	    xmlhttp.open(sendType, url, true);
	    if ( sendType.toLowerCase() == 'post') {
	        xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
	    }
	    xmlhttp.setRequestHeader('X_REQUESTED_WITH','XMLHttpRequest');
	    xmlhttp.onreadystatechange  = function() {
	       if ( xmlhttp.readyState != 4 ) return;
               if ( xmlhttp.status != 200 && xmlhttp.status != 304 ) {
                   alert ( 'HTTP error ' + xmlhttp.status );
                   return;
	       }
               callback(xmlhttp);
	    }
	    xmlhttp.send(data||null);
	}
    }
    function callback(xmlhttp) {
        var returnData = eval( '('+ xmlhttp.responseText +')' );
	alert(returnData);
    }
    $(function(){
        //sendRequest('post','/index/helper',callback,'name=我是中文');
        //$.post('/index',{id:007},function(data){
	//   console.log(data);
	//});

    });
</script>
</head>

<body>
    <h1>Ajax</h1>
    <p>貌似不支持中文(echo by html)</p>
    <p><?=$this->name?></p>
</body>
</html>